RCS "$Id: UI.sig,v 1.12 1998/08/13 11:35:12 pxs Exp $";
(* This stuff is not yet fully thought out *)
signature UI =
sig
  val banner : unit -> unit
  val cwb : string -> unit

(* We have stacks of input & output files: *)
  val pushInFile : string -> unit
  val pushOutFile : string -> unit
  val popOutFile : unit -> unit

  val debug : string -> unit
  val debugFn : (unit -> string) -> unit
  val debuggingOn : unit -> bool
  val error : string -> unit (* print to stderr, newlines,*** before & after *)
  val errorWithHelp : string -> unit
  val fatalError : string -> unit (* as error, plus reset infile to stdin *)
  val getMaxLookUp : unit -> int
  val help : string -> unit
  val message : string -> unit (* print to stdout, newlines before & after *)
  (* like message, but user can choose not to get these *)
  val chat : string -> unit
  val print : string -> unit		(* print to outfile, newline after *)
  val interactive : unit -> bool
(* take a prompt, return response up to ; *)
  val readcommand : string -> string
(* String should be something it may be useful to give help on, *)
(* typically the first word of the most recent command. *)
  val setcontext : string -> unit
(* String should be the most recent command.*)
  val setCommand : string -> unit
  val setMaxLookUp : int -> unit
(* return true for y, false for n. 1st arg is returned when not interactive *)
  val yOrN : bool -> string -> bool
(* Just for when we want to stop and get the user to acknowledge, *)
(* if there is a user! Noop if not interactive.*)
  val hitReturnToContinue : unit -> unit
(* Set this to true if you want not to ask the user to choose from a list *)
(* containing just one element. Default to false because this seems to be *)
(* confusing in practice. *)
  val takeUniqueChoice : bool ref
(* Given a list and a way to stringify its elements, print it with numbers. *)
  val printListNumbered : ('a -> string) -> 'a list -> unit
(* Get the user to pick from a list, return the chosen element *)
(* prompt, how to make string, list *)
  val pickFromList : string -> ('a -> string) -> 'a list -> 'a
(* More complicated version! Take a fn to say whether an entry which isn't *)
(* a valid choice number may nevertheless be valid. If given such an entry, *)
(* return it as the argument to Picked. (The client should know what to do!)*)
(* Also, return the elements before and after the chosen element too. *)
  exception Picked of string
(* prompt, how to make string, list *)
  val pickFromListC : (string -> bool) -> string -> ('a -> string) -> 'a list
    -> 'a list * 'a * 'a list
(* Allows the user to set values of various toggles. *)
  val toggle : string -> unit
(* register a true/false user option. Give the name, the documentation string*)
(* the bool ref is the toggle itself, and the function to call to do the     *)
(* toggle (the function should toggle the bool ref, but it might also print *)
(* a message, ask for confirmation or whatever. *)
(* Toggle facility is currently more naive than Registry stuff: there's no *)
(* check for duplicate toggles, for example. Should enhance this? *)
  val addToggle : (string * string * bool ref * (unit -> unit)) -> unit
  val authorized : unit -> bool
  val authorize : string -> unit
  val userHatesGames : unit -> bool
(* Command stuff: *)
  include DYNAMIC_COMMANDS
end





